import request from '@/utils/request'

// 获取考试列表
export function getExamlist(params) {
  return request({
    url: '/api/exams/paging',
    method: 'get',
    params,
  })
}

// 添加考试
/**
 * @param {
 * "title": "string",
 * "examDuration": 0,
 * "maxCount": 0,
 * "passedScore": 0,
 * "startTime": "string",
 * "endTime": "string",
 * "gradeIds": "string",
 * "repoId": 0,
 * "certificateId": 0,
 * "radioCount": 0,
 * "radioScore": 0,
 * "multiCount": 0,
 * "multiScore": 0,
 * "judgeCount": 0,
 * "judgeScore": 0,
 * "saqCount": 0,
 * "saqScore": 0} data 
 * @returns 
 */
export function addExam(data) {
  return request({
    url: '/api/exams',
    method: 'post',
    data,
  })
}

// 编辑考试
export function updateExam(data) {
  return request({
    url: `/api/exam/update/${data.id}`,
    method: 'put',
    data,
  })
}

// 删除考试
export function deleteExam(id) {
  return request({
    url: `/api/exam/delete/${id}`,
    method: 'delete',
  })
}

// 获取考试详情
export function getExamDetail(id) {
  return request({
    url: `/api/exam/detail/${id}`,
    method: 'get',
  })
}
